﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ResetRCSModules.CCCoResetRCSModuleCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.Collections.ObjectModel;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands.ResetRCSModules;

public class CCCoResetRCSModuleCmd : TxButtonCommand
{
  private CCApResetRCSModulesEnabler m_enabler;

  public CCCoResetRCSModuleCmd() => this.m_enabler = new CCApResetRCSModulesEnabler();

  public virtual void Execute(object cmdParams)
  {
    Cursor current = Cursor.Current;
    Cursor.Current = Cursors.WaitCursor;
    try
    {
      TxObjectList allItems = TxApplication.ActiveSelection.GetAllItems();
      if (((Collection<ITxObject>) allItems).Count == 1)
      {
        TxRobot txRobot = ((Collection<ITxObject>) allItems)[0] as TxRobot;
        if (TxRobot.op_Inequality(txRobot, (ITxObject) null))
          new TxRRSServicesProvider(txRobot).Restart();
      }
    }
    catch (TxException ex)
    {
      int num = (int) TxMessageBox.Show(StringTable.CMD_FAILURE_MSG + ((Exception) ex).Message, StringTable.CMD_ERROR_DIALOGG_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Hand);
    }
    Cursor.Current = current;
  }

  public virtual string Bitmap => StringTable.CMD_BITMAP;

  public virtual ITxImage Image => (ITxImage) TxImageManager.GetImageByKey("ResetRcsModule");

  public virtual string Category => StringTable.CMD_CATEGORY;

  public virtual ITxCommandEnabler CommandEnabler => (ITxCommandEnabler) this.m_enabler;

  public virtual string Description => StringTable.CMD_DESCRIPTION;

  public virtual string Name => StringTable.CMD_NAME;

  public virtual string Tooltip => StringTable.CMD_TOOLTIP;

  public virtual bool Connect() => true;

  public virtual bool Licensed => TxCommandLicenser.ResetRCSModuleLicense;
}
